<?php
/**
 * Fastapp.
 * 3/7/24
 * @Author deepsea
 * @Contact telegram:deepsea159
 */


namespace App\Fastapp\Api\Controller\Cms;

use App\Fastapp\Api\Controller\ApiController;
use App\Fastapp\Api\Service\Cms\ArticleService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\GetMapping;
use Psr\Http\Message\ResponseInterface;

#[Controller(prefix: 'api/cms/article')]
class ArticleController extends ApiController
{
    #[Inject]
    public ArticleService $service;

    #[GetMapping('list')]
    public function list(): ResponseInterface
    {
        return $this->success($this->service->list($this->request->input('code')));
    }

    #[GetMapping('detail')]
    public function detail(): ResponseInterface
    {
        return $this->success($this->service->detail($this->request->input('code')));
    }

    #[GetMapping('notice')]
    public function notice(): ResponseInterface
    {
        return $this->success($this->service->notice());
    }
}